
/**
 *  Test suite: top level, basically the feature you're trying to test.
 *  Batches: a test suite is a set of batches, run in order and sequentially.
 *  Contexts: right underneath batches, this is basically one given functionality. Contexts are run in parallel.
 *  Vows: atomic checks you want to do to validate the functionality. There are 2 special kind of vow, topic and teardown, which are run first and last. Otherwise all vows are run in parallel. Vows can contain nested contexts.
 */

//test Topic Service suite,
//batch, run sequentially, you can add another Batch

var $ = require;

var path = $('path');
require.paths.unshift(path.join(__dirname, '../..', 'services'));  //add services to require.paths
var topicService = $('topicService').topicService;

var vows = $('vows'),
    assert = $('assert');

vows.describe('test TopicService').addBatch({
    
    //one context, may contains many topic or nested context
    'Job Topic Service': {
        topic: function(){
            var jobTopicService = topicService.get('job');
            
            //each check below is invoked with these parameters, first is error, which is null
            this.callback(null, topicService);
        },
        
        'topicService is not null': function(error, topicService){
             assert.isNotNull(topicService);
        },
        
        'jobTopicService is not null': function(error, topicService){
             assert.equal('job', topicService.JOB_TYPE);
             jobTopicService = topicService.get(topicService.JOB_TYPE);
             assert.isNotNull(jobTopicService);
        }
    },
}).export(module);